<template>
	<view>
		<cu-custom bgColor="bg-blue" :isBack="true">
			<block slot="content">消息通知</block>
		</cu-custom>
		<view>
			<!-- <view class="msglist flex" style="margin-top: 20rpx;">
				<view class="icopic">
					<text class="schoolbox iconfont icon-xiaoxi"></text>
				</view>
				<view class="msgword">
					<view class="headlineWord">企业加入申请</view>
					<view class="specificWord">唯宅汇科技有限公司同意了您的申请</view>
				</view>
				<view class="tiemword">{{timeToStr(item.add_time,"MM-dd hh:mm")}}</view>
			</view> -->
			<view class="msglist flex" style="margin-top: 20rpx;" @tap="tomessagelist">
				<view class="icopic">
					<text class="schoolbox iconfont icon-xiaoxi"></text>
					<text class="countnums" v-if="msgnums.count>0">{{msgnums.count}}</text>
				</view>
				<view class="msgword">
					<view class="headlineWord">系统通知</view>
					<view class="specificWord">{{msgnums.content}}</view>
				</view>
				<view class="tiemword">{{timeToStr(msgnums.add_time,"MM-dd hh:mm")}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	const {appLogin,httpGet,httpPost,msg,timeToStr} = require("@/utils/common.js")
	export default {
		data() {
			return {
				timeToStr:timeToStr,
				msgnums:[],
				count:'',
			}
		},
		onLoad() {
			appLogin((user_info) => {
				console.log(user_info)
				this.getnoticecount()
			})
		},
		methods: {
			getnoticecount(){
				httpGet({
					url:'/api/student/notice_count',
				}).then((res)=>{
					console.log(res)
					this.msgnums = res.result['10']
				})
			},
			tomessagelist(){
				uni.navigateTo({
					url:"/pages/student/messageolist"
				})
			}
		}
	}
</script>

<style>
	.msglist{
		width: 100%;
		height: 160rpx;
		background-color: white;
		padding-top: 40rpx;
		padding-left: 30rpx;
		border-bottom: solid 1px #E7EBED;
		color: #666666;
	}
	.icopic{
		width: 80rpx;
		height: 80rpx;
		background-color: #48d7ab;
		border-radius: 15rpx;
		padding: 20rpx;
		/* position: relative; */
	}
	.schoolbox{
		font-size: 40rpx;
		color: white;
	}
	.headlineWord{
		font-size: 30rpx;
		font-weight: bold;
		color: #010101;
	}
	.specificWord{
		font-size: 30rpx;
		color: #999999;
	}
	.msgword{
		margin-left: 20rpx;
	}
	.countnums{
		width: 35rpx;
		height: 35rpx;
		border:solid; 
		border-color: white; 
		border-width: 1px;
		border-radius: 100%;
		background-color: #fc5366;
		position: absolute;
		margin-top: -30rpx;
		color: white;
		text-align: center;
	}
	.tiemword{
		margin-left: 320rpx;
	}
</style>
